package com.xcyy.clbzbh.repository;


import com.xcyy.clbzbh.entity.Benchmark;
import com.xcyy.clbzbh.entity.GPSPoint;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface GPSPointRepository extends JpaRepository<GPSPoint,String> , JpaSpecificationExecutor<GPSPoint> {
    List<GPSPoint> findByName(String name);
    List<GPSPoint> findByPointID(String pointId);
    Page<GPSPoint> findByCity(String city, Pageable pageable);
    Page<GPSPoint> findByCityAndCountry(String city,String country, Pageable pageable);
    List<GPSPoint> findByCountry(String country);
    @Query(value = " select sum(IF(STATUS='已入库',1,0)) rkwcs ,sum(IF(STATUS='分发',1,0)) ffwcs ,sum(IF(STATUS='已提交',1,0)) tjwcs ,sum(IF(STATUS='已审核',1,0)) shwcs ,sum(IF(STATUS='驳回',1,0)) bhwcs ,COUNT(*) zs  FROM gpspoint",nativeQuery = true)
    Object totalgpspoint();

}
